package com.tudouji.project.flow.service.impl;

import com.flow.service.pojo.flow.FlowTempNode;
import com.tudouji.common.utils.IdUtils;
import com.tudouji.project.flow.domain.Flowtempnode;
import com.tudouji.project.flow.mapper.FlowtempnodeMapper;
import com.tudouji.project.flow.service.IFlowtempnodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 流程节点Service业务层处理
 *
 * @author wf
 * @date 2021-04-01
 */
@Service
public class FlowtempnodeServiceImpl implements IFlowtempnodeService
{
    @Autowired
    private FlowtempnodeMapper flowtempnodeMapper;

    /**
     * 查询流程节点
     *
     * @param guid 流程节点ID
     * @return 流程节点
     */
    @Override
    public Flowtempnode selectFlowtempnodeById(String guid)
    {
        return flowtempnodeMapper.selectFlowtempnodeById(guid);
    }

    /**
     * 通过id查询流程节点
     * @param id
     * @return
     */
    @Override
    public FlowTempNode selectFlowtempnodeByid(Long id) {
        FlowTempNode flowtempnode=flowtempnodeMapper.selectFlowtempnodeByid(id);
        return flowtempnode;
    }

    /**
     * 查询流程节点列表
     *
     * @param flowtempnode 流程节点
     * @return 流程节点
     */
    @Override
    public List<FlowTempNode> selectFlowtempnodeList(FlowTempNode flowtempnode)
    {
        return flowtempnodeMapper.selectFlowtempnodeList(flowtempnode);
    }

    /**
     * 新增流程节点
     *
     * @param flowtempnode 流程节点
     * @return 结果
     */
    @Override
    public int insertFlowtempnode(Flowtempnode flowtempnode)
    {
        flowtempnode.setGuid(IdUtils.fastSimpleUUID());
        return flowtempnodeMapper.insertFlowtempnode(flowtempnode);
    }

    @Override
    public int insertFlowTempnode(FlowTempNode flowtempnode) {
        return flowtempnodeMapper.insertFlowTempnode(flowtempnode);
    }

    /**
     * 修改流程节点
     *
     * @param flowtempnode 流程节点
     * @return 结果
     */
    @Override
    public int updateFlowtempnode(Flowtempnode flowtempnode)
    {
        return flowtempnodeMapper.updateFlowtempnode(flowtempnode);
    }

    @Override
    public int updateFlowTempnode(FlowTempNode flowtempnode) {
        System.out.println(flowtempnode);
        return flowtempnodeMapper.updateFlowTempnode(flowtempnode);
    }

    /**
     * 批量删除流程节点
     *
     * @param guids 需要删除的流程节点ID
     * @return 结果
     */
    @Override
    public int deleteFlowtempnodeByIds(String[] guids)
    {
        return flowtempnodeMapper.deleteFlowtempnodeByIds(guids);
    }

    /**
     * 删除流程节点信息
     *
     * @param guid 流程节点ID
     * @return 结果
     */
    @Override
    public int deleteFlowtempnodeById(String guid)
    {
        return flowtempnodeMapper.deleteFlowtempnodeById(guid);
    }

    @Override
    public List<Flowtempnode> getDoneNodes(Flowtempnode node)
    {
        return flowtempnodeMapper.getDoneNodes(node);
    }

    @Override
    public List<Flowtempnode> getUndoNodes(Flowtempnode node)
    {
        return flowtempnodeMapper.getUndoNodes(node);
    }

    @Override
    public List<FlowTempNode> getPendingNodes(FlowTempNode node)
    {
        return flowtempnodeMapper.getPendingNodes(node);
    }
}
